<%-- 
    Document   : dogodki
    Created on : 28.6.2011, 1:09:21
    Author     : tincek
--%>

<%@page import="gandalf.model.Vstopnica"%>
<%@page import="gandalf.model.Dogodek"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="gandalf.controller.DogodekDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <%DogodekDao dogodekDao = new DogodekDao();
        List<Dogodek> dogodki = new ArrayList<Dogodek>();
        String id = request.getParameter("id");
                if (id != null && id != "") {
                    long id1 = Long.parseLong(id);
                    dogodekDao.destroy(id1);
                }
        dogodki = dogodekDao.all(true);%>

    <body>
        <table>
	<tr>
		<th width="20" >Id</th>
		<th width="270" >Naziv</th>
		<th width="85" >Opis</th>
		<th width="85" >Datum</th>
                <th width="85" >Lokacija</th>
		<th width="160" >Kategorija</th>
                <th width="160" >Vstopnice</th>
                <th width="160" >Opcije</th>
	</tr>
         <% for (Dogodek d : dogodki) {%>
         <tr>
			<td><%=d.getId()%></td>
                        <td><%=d.getNaziv()%></td>
                        <td><%=d.getOpis()%></td>
			<td><%=d.getLepIzpisDatuma()%></td>
                        <td><%=d.getLokacija().toString()%></td>
                        <td><%=d.getKategorija()%></td>
                        <td width=200">
                            <table border="2">
                            <%for(Vstopnica v: d.getVstopnice()){%><tr><td>
                                <%=v.getVrsta() + " " + v.getCena() + " EUR ("+v.getKolicina()+")\n"%></td></tr><%}%>
                            </table></td>

                        <td><a href="vmesnik.jsp?Stran=urediDogodek.jsp?id=<%=d.getId() %>" class="example1" ><img src="blueprint/plugins/buttons/icons/key.png" alt="Uredi"/></a> |
			<a href="vmesnik.jsp?Stran=dogodki.jsp?id=<%=d.getId() %>" class="example1" ><img src="blueprint/plugins/buttons/icons/cross.png" alt="Zbrisi"/></a></td>


		</tr>

  <% }%>
  </table>
    </body>
</html>
